<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="axios.min.js"></script>
</head>
<body>
<form action="http://127.0.0.1:8080/post.do" method="post">
    name : <input type="text" name="name"><br>
    pwd : <input type="text" name="pwd"><br>
    <button>提交</button>
</form>
<hr>
<form action="http://127.0.0.1:8080/post.do" method="post"
      enctype="multipart/form-data">
    name : <input type="text" name="name"><br>
    pwd : <input type="text" name="pwd"><br>
    file : <input id="myfile" type="file" name="file"><br>
    <button>提交</button>
</form>
<hr>
<button onclick="get()">axios get</button>
<button onclick="post()">axios post</button>
<button onclick="upfile()">axios file upload</button>
<script>
    function get(){
        axios.get("http://127.0.0.1:8080/404.do",{
            params : {
                name : "zhangsan",
                age : 18,
            }
        })
    }

    function post(){
        let params = new URLSearchParams();
        params.append("name","zhangsan");
        params.append("age","18");
        axios.post("http://127.0.0.1:8080/404.do",params);
    }

    function upfile(){
        let params = new FormData();
        params.append("name","zhangsan");
        params.append("age","18");
        params.append("file", myfile.files[0])
        axios.post("http://127.0.0.1:8080/404.do",params);
    }
</script>
</body>
</html>